package com.ynny.Service.Impl;

import com.ynny.Dao.CourseManagerDao;
import com.ynny.Dao.Impl.optional_coursesDaoImpl;
import com.ynny.Entity.Courses;
import com.ynny.Entity.optional_courses;
import com.ynny.Service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class CourseServiceImp implements CourseService {
    @Autowired
    private optional_coursesDaoImpl optional_coursesDao;
    @Autowired
    private CourseManagerDao courseManagerDao;

    @Override
    public int selectCourse(String number, String courseName) {
        return optional_coursesDao.addCourse(number,courseName,0.0);
    }

    @Override
    public List<Courses> query() {
        return courseManagerDao.queryCourse();
    }

    @Override
    public optional_courses queryCourseByNumber(String number) {
        return optional_coursesDao.CourseByNumber(number);
    }
}
